<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en">
<head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <title>Galaxy Explorer (grey) </title>

    <script type="text/javascript" src="../style/GalaxyExplorerHTML/script.js"></script>
	<script type='text/JavaScript' src='scw.js'></script>  

    <link rel="stylesheet" href="../style/GalaxyExplorerHTML/style.css" type="text/css" media="screen" />

    <SCRIPT type="text/javascript">

	var listImages=new Array();
	
	
	var pos = 0;
	
	
	function initialize(){
	
	
	<?php if (!(isset($_COOKIE['login']))): ?>
		deconnect();
	<?php endif; ?>
	
	<?php if(isset($images)):?>
		
		<?php for($i=0;$i<sizeof($images);$i++):?>
	
		listImages.push("<?php echo $images[$i][1];?>");
		
		document.getElementById("selectImage").options[<?php echo $i ?>]= new Option("<?php echo substr($images[$i][1],0,strpos($images[$i][1],"."));?>","<?php echo $images[$i][0] ?>");
		<?php if (isset($_POST['ajouter'])): 		
		if ( ($images[$i][0]== $_POST['selectImage'])):?>
		document.getElementById("selectImage").selectedIndex=<?php echo $i?>;
		document.getElementById("image").src="../image/media/"+listImages[<?php echo $i?>];
	
		<?php endif;?>	
		<?php endif;?>	
		<?php endfor;?>	
	<?php endif;?>		
	}
	
	function deconnect(){
		
		
		 document.location.href="<?php echo site_url('connexionUser')?>";		 
		
	 }
	
	function next(){
		pos++;
		if (pos == listImages.length) pos=0;	
		document.getElementById("image").src="../image/media/"+listImages[pos];
		document.getElementById("selectImage").selectedIndex=pos;
		document.getElementById("fileImage").value="";
	}
	
	function previous(){
		pos--;
		if (pos == -1) pos=listImages.length-1;	
		document.getElementById("image").src="../image/media/"+listImages[pos];
		document.getElementById("selectImage").selectedIndex=pos;
		document.getElementById("fileImage").value="";
	}
	
	function changeSelection(){
		document.getElementById("image").src="../image/media/"+listImages[document.getElementById("selectImage").selectedIndex];
		document.getElementById("fileImage").value="";
	}

	</SCRIPT>
	
</head>
<body onLoad="initialize();">
<div id="art-page-background-simple-gradient">
    </div>
    <div id="art-page-background-glare">
        <div id="art-page-background-glare-image"></div>
    </div>
    <div id="art-main">

        <div class="art-Sheet">
            <div class="art-Sheet-tl"></div>
            <div class="art-Sheet-tr"></div>
            <div class="art-Sheet-bl"></div>
            <div class="art-Sheet-br"></div>
            <div class="art-Sheet-tc"></div>
            <div class="art-Sheet-bc"></div>
            <div class="art-Sheet-cl"></div>
            <div class="art-Sheet-cr"></div>

            <div class="art-Sheet-cc"></div>
            <div class="art-Sheet-body">
                <div class="art-nav">
                	<div class="l"></div>
                	<div class="r"></div>
                	<ul class="art-menu">
                		<li>
                			<a href="#" ><span class="l"></span><span class="r"></span><span class="t">Exposition</span></a>
							<ul>
								<li><a href="<?php echo site_url('ajoutExposition')?>">Ajout</a></li>
                				<li><a href="<?php echo site_url('modifExposition')?>">Mes expositions</a></li>
                			</ul>

                		</li>
                		<li>
                			<a href="#" class=" active"><span class="l"></span><span class="r"></span><span class="t">Oeuvre</span></a>
                			<ul>
								<li><a href="<?php echo site_url('ajoutOeuvre')?>">Ajout</a></li>
                				<li><a href="<?php echo site_url('ModifOeuvre')?>">Mes oeuvres</a></li>
                			</ul>

                		</li>		
                		<li>
                			<a href="#"><span class="l"></span><span class="r"></span><span class="t">Media</span></a>
							<ul>
								<li><a href="<?php echo site_url('ajoutMedia')?>">Ajout</a></li>
                				<li><a href="<?php echo site_url('ModifMedia')?>">Mes medias</a></li>
                			</ul>
							
                		</li>
                	</ul>
                </div>
                <div class="art-Header">
                    <div class="art-Header-jpeg"></div>
                    <div class="art-Logo">

                        <h1 id="name-text" class="art-Logo-name"><a href="#">Gestion des oeuvres</a></h1>
                        <div id="slogan-text" class="art-Logo-text">Ajout d'une oeuvre</div>

                    </div>
                </div>
                <c<div class="art-contentLayout">
                    <div class="art-content">
                        <div class="art-Post">
                            <div class="art-Post-body">

                        <div class="art-Post-inner">
						
                               <?php echo validation_errors(); ?>  
								<?php if (isset($error)) echo $error;?>
                                        <div class="art-PostContent">
                                         
										 
										<form enctype="multipart/form-data" method="post" action="<?php echo site_url('ajoutOeuvreValidation')?>" >

											
											
											<div class="art-Block">
                                            			<div class="art-Block-body">
                                            				<div class="art-BlockHeader">
                                                      <div class="l"></div>
                                            				  <div class="r"></div>
                                            				  <div class="t"><center>Description</center></div>

                                            			  </div>
                                            				
                                            				</div>
                                            			</div>

                                            		
											<div class="art-Block" id='desciption'>
												
											

												<TABLE BORDER="0">
													
													<tr> <td><b>Nom (*) :</b></td> <td><input name="nom" value="<?php if (isset($_POST['ajouter'])) echo $_POST['nom'];?>" type="text" maxlength="40" ></td> </tr>
													<tr> <td><b>Presentation :</b></td> <td><input name="presentation" value="<?php if (isset($_POST['ajouter']))echo $_POST['presentation'];?>" type="text" maxlength="200" size ="80"></td> </tr>
													<tr> <td><b>Descriptif:</b></td> <td><TEXTAREA  name="descriptif" ><?php if (isset($_POST['ajouter']))echo $_POST['descriptif'];?></TEXTAREA></td></tr>


												</TABLE> 

											</div>
											<br/><br/>

											<div class="art-Block">
                                            			<div class="art-Block-body">
                                            				<div class="art-BlockHeader">
                                                      <div class="l"></div>
                                            				  <div class="r"></div>
                                            				  <div class="t"><center>Origine</center></div>

                                            			  </div>
                                            				
                                            				</div>
                                            			</div>

                                            		
											<div class="art-Block" id='origine'>
												
											

												<TABLE BORDER="0">
												
													<tr> <td><b>Auteur :</b></td> <td><input name="auteur" value="<?php if (isset($_POST['ajouter'])) echo $_POST['auteur'];?>" type="text" maxlength="40" ></td> </tr>
													<tr> <td><b>Periode :</b></td> <td>
													<SELECT name ="periode" >
													<OPTION > inconnue
													<OPTION value="XII" <?php if (isset($_POST['ajouter'])) if ($_POST['periode']==="XII") echo "selected"; ?>> XII i&egrave;me
													<OPTION value="XIII"<?php if (isset($_POST['ajouter'])) if ($_POST['periode']==="XIII") echo "selected"; ?>> XIII i&egrave;me
													<OPTION value="XIV"<?php if (isset($_POST['ajouter'])) if ($_POST['periode']==="XIV") echo "selected"; ?>> XIV i&egrave;me
													<OPTION value="XV"<?php if (isset($_POST['ajouter'])) if ($_POST['periode']==="XV") echo "selected"; ?>> XV i&egrave;me
													<OPTION value="XVI"<?php if (isset($_POST['ajouter'])) if ($_POST['periode']==="XVI") echo "selected"; ?>> XVI i&egrave;me
													<OPTION value="XVII"<?php if (isset($_POST['ajouter'])) if ($_POST['periode']==="XVII") echo "selected"; ?>> XVII i&egrave;me
													<OPTION value="XVIII"<?php if (isset($_POST['ajouter'])) if ($_POST['periode']==="XVIII") echo "selected"; ?>> XVIII i&egrave;me
													<OPTION value="IXX"<?php if (isset($_POST['ajouter'])) if ($_POST['periode']==="IXX") echo "selected"; ?>> IXX i&egrave;me
													<OPTION value="XX"<?php if (isset($_POST['ajouter'])) if ($_POST['periode']==="XX") echo "selected"; ?>> XX i&egrave;me

													<tr> <td><b>Pays:</b></td> <td><input name="pays" value="<?php if (isset($_POST['ajouter'])) echo $_POST['pays'];?>" type="text" maxlength="40" ></td> </tr>

												</TABLE> 

											</div>
											<br/><br/>
											
											
											<div class="art-Block">
                                            			<div class="art-Block-body">
                                            				<div class="art-BlockHeader">
                                                      <div class="l"></div>
                                            				  <div class="r"></div>
                                            				  <div class="t"><center>Illustration(*)</center></div>

                                            			  </div>
                                            				
                                            				</div>
                                            			</div>

                                            		
											<div class="art-Block" id='illustration'>
												
											<IMG class ="bullet" SRC="../image/jouer-a-droite-fleche-icone-6822-16.png"><b>T&eacute;l&eacute;charger une nouvelle image (elle sera automatiquement ajout&eacute;e a vos medias):</b>
											<br><br>
											<div class="art-Block-body">												
												<input id="fileImage" type="file" name="fileImage" value=<?php if (isset($_POST['ajouter']))echo $_FILES['fileImage']['name'];?>> 
											</div>
											<br>	
											<?php if(isset($images)):?>
											<IMG class ="bullet" SRC="../image/jouer-a-droite-fleche-icone-6822-16.png"><b>Ou s&eacute;lectionner une image de vos m&eacute;dias:</b>
											<br><br>
											<div class="art-Block-body">
												
												
												<div class="image">
												<SELECT id="selectImage" name="selectImage" onChange="changeSelection();">
																							
												</SELECT>
												<br><br>
												
												<IMG class ="flechegauche" SRC="../image/fleche-a-gauche-avant-icone-5338-32.png"onClick="previous();">
												<IMG id="image" class ="image" SRC=<?php if (isset($images)) echo "../image/media/".$images[0][1];?> style="height:150px">
												<IMG class ="flechedroite" SRC="../image/fleche-a-cote-a-droite-icone-6873-32.png" onClick="next();">
												
												</div>
												<br>
											</div>
											<?php endif;?>
											</div>
											<br/><br/>
<div class="art-Block">
                                            			<div class="art-Block-body">
                                            				<div class="art-BlockHeader">
                                                      <div class="l"></div>
                                            				  <div class="r"></div>
                                            				  <div class="t"><center>Ajouter l'oeuvre &agrave; des expositions (optionel)</center></div>

                                            			  </div>
                                            				
                                            				</div>
                                            			</div>

                                            		
											<div class="art-Block" id='exposition'>
												
											

												

													<b>Expositions :</b>
													<SELECT name ="selectExposition[]" multiple size=3 >
													<?php if (isset ($expositions)):?>
													<?php foreach($expositions as $exposition):?>
													<OPTION value =<?php echo $exposition[0];?> <?php if (isset($_POST['ajouter']) && isset($_POST['selectExposition']) ) if (in_array($exposition[0],$_POST['selectExposition'])) echo "selected"; ?>><?php echo $exposition[1];?>
													<?php endforeach;?>
													<?php endif;?>
												</SELECT>


												
											</div>
											<br/><br/>
											

											<hr/>

											<div id="validation">

												* : champs obligatoires<br/>
												<span id="avertissement"style="display:none;" >Vous n'avez pas rempli tous les champs obligatoires</span><br/>
												<center><input name="ajouter" class="art-button" type=submit value="Ajouter"> <input class="art-button" type=reset value="Annuler"></center>
											</div>



										</form>
                                            
                                           
									
                                            
                                            
                                                
                                        </div>
                                        
                        </div>
                        
                        		
                            </div>

                        </div>
                        
                    </div>
					
					<div class="art-sidebar1">
					 
                           
									
									
                     
                </div>
                   
                </div>
               

        		<div class="cleared"></div>
				
            </div>
			<div class="cleared"></div><div class="art-Footer">
                    <div class="art-Footer-inner">
					
					<div class="art-Footer-text">
							<IMG class ="user" SRC="../image/lhomme-personnes-personne-utilisateur-icone-6535-32.png">					
                            <p><?php  echo $_COOKIE['login'];?></p>
							
                       </div>
						<IMG id ="fermer" SRC="../image/bye-shutdown-icone-5302-16.png" onclick="deconnect();">
                       
                    </div>
                    <div class="art-Footer-background"></div>
                </div>

        		<div class="cleared"></div>
            </div>
        </div>
        <div class="cleared"></div>
        <p class="art-page-footer"></p>

        </div>
        
        
    </div>
	
	
    
</body>

</html>
